﻿using ATM.BUS;
using ATM.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ATMSystem
{
    public partial class frmReceivedID : Form
    {
        private Account passAcc;
        private Card passCard;
        public frmReceivedID()
        {
            InitializeComponent();
        }

        public frmReceivedID(Account acc,Card card)
        {
            InitializeComponent();
            passAcc = acc;
            passCard = card;
        }

        private List<ATMMoneyItem> MoneyStore = new List<ATMMoneyItem>();
        public string AccCusID = "2";

        private void btnClear_Click(object sender, EventArgs e)
        {
            txtReceiveID.Clear();
            txtReceiveID.Focus();
        }

        private void btnEnter_Click(object sender, EventArgs e)
        {
            try
            {
                bool check = CardTransferBUS.CheckAccountReceived_ID(txtReceiveID.Text.Trim());
                if (check == true)
                {
                    frmReceiveName frm1 = new frmReceiveName(passAcc,passCard);
                    //this.Visible = false;
                    frm1.AccCusID = AccCusID;
                    frm1.AccReceiveID = txtReceiveID.Text.Trim();
                    frm1.nameReceiveID = CardTransferBUS.NameReceived_ID(txtReceiveID.Text.Trim());
                    frm1.Show();
                }
                else
                {
                    txtReceiveID.Text = "Tài khoản không đúng!";
                }
            }
            catch
            {
                return;
            }
        }


        private void txtReceiveID_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsDigit(e.KeyChar) && e.KeyChar != '\b')
            {
                e.Handled = true;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }


    }
}
